from app import celery, cache
from ..api.gateio.modles import query_futures_tickers

@celery.task
def fetch_and_cache_tickers(gate_key, gate_secret, settle, contract=None):
    response = query_futures_tickers(gate_key, gate_secret, settle, contract)
    if response.get("code") == 200:
        cache_key = f"{settle}_{contract}"
        cache.set(cache_key, response, timeout=300)


